# coding:utf-8

from marshmallow import fields, validate

from ..extensions import ma


class PayTypeSchema(ma.Schema):
    """
    created by chenhj at 2017/8/15

    """
    type = fields.Int(required=True, error_messages={
        'required': '套餐类型不合法'
    }, validate=validate.Range(1, 3, error='套餐类型不合法'))

pay_type_schema = PayTypeSchema()


class HalfPriceSchema(ma.Schema):
    """
    create by ld_wu 2017-10-30
    """
    bid_point = fields.Int(required=True, error_messages={
        'required': '汇币为必填'
    }, validate=validate.Range(1, error='购买汇币必须大于0'))

half_price_schema = HalfPriceSchema()


class AliBillSchema(ma.Schema):
    """
    created by chenhj at 2017/8/18

    """
    id = fields.Int()
    alipay_code = fields.Str(attribute='chnl_code')
    uid = fields.Int()
    type = fields.Int()
    sub_type = fields.Int()
    item = fields.Str()
    amt = fields.Str()
    call_point = fields.Int()
    sms_point = fields.Int()
    desc = fields.Str()
    bank_name = fields.Str()
    bank_acct_name = fields.Str()
    bank_acct_num = fields.Str()
    status = fields.Int()
    created_at = fields.Int()
    updated_at = fields.Int()
    deleted_at = fields.Int()

ali_bill_schema = AliBillSchema()


class AliBillCheckSchema(ma.Schema):
    """
    created by chenhj at 2017/8/23

    """
    bill_id = fields.Int(required=True, error_messages={
        'required': 'bill_id不合法'
    })

ali_bill_check_schema = AliBillCheckSchema()
